import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: happyiu
 * Date: 2021-11-02
 * Time: 16:25
 */
public class TestDemo {

    public static int sum(int A, int B) {

        int ret = A + B;
        return ret;
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int ret = sum(a, b);
        System.out.println(ret);

    }

    public static void main2(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println("第一次调用方法之前");
        int ret = add(a, b);
        System.out.println("第一次调用方法之后");
        System.out.println("ret = " + ret);
        System.out.println("第二次调用方法之前");
        ret = add(30, 50);
        System.out.println("第二次调用方法之后");
        System.out.println("ret = " + ret);
    }
        /*public static int add(int x, int y) {
            System.out.println("调用方法中 x = " + x + " y = " + y);
            return x + y;
        }*/
    //    执行结果
    //    一次调用方法之前
    //    调用方法中 x = 10 y = 20
    //    第一次调用方法之后
    //            ret = 30
    //    第二次调用方法之前
    //    调用方法中 x = 30 y = 50
    //    第二次调用方法之后
    //            ret = 80

    public static void swap(int x, int y) {
        int tmp = x;
        x = y;
        y = tmp;
    }

    public static void main3(String[] args) {
        int a = 10;
        int b = 20;
        swap(a, b);
        System.out.println("a = " + a + " b = " + b);

    }
// 运行结果
//    a = 10 b = 20


    public static void main4(String[] args) {
        int[] arr = {10, 20};
        swap(arr);
        System.out.println("a = " + arr[0] + " b = " + arr[1]);
    }

    public static void swap(int[] arr) {
        int tmp = arr[0];
        arr[0] = arr[1];
        arr[1] = tmp;
    }

    // 运行结果
    //    a = 20 b = 10

    public static int add1(int x, int y) {
        return x + y;
    }

    public static void main5(String[] args) {
        int a = 10;
        int b = 20;
        int ret = add1(a, b);
        System.out.println("ret = " + ret);

        double a2 = 10.5;
        double b2 = 20.5;
        double ret2 = add1(a, b);
        System.out.println("ret2 = " + ret2);
    }


    public static void main6(String[] args) {
        int a = 10;
        int b = 20;
        int ret = add2(a, b);
        System.out.println("ret = " + ret);
        double a2 = 10.5;
        double b2 = 20.5;
        double ret2 = add2(a2, b2);
        System.out.println("ret2 = " + ret2);
    }

    public static int add2(int x, int y) {
        return x + y;
    }

    public static double add2(double x, double y) {
        return x + y;
    }


    public static void main7(String[] args) {
        int a = 10;
        int b = 20;
        int ret = add(a, b);
        System.out.println("ret = " + ret);
        double a2 = 10.5;
        double b2 = 20.5;
        double ret2 = add(a2, b2);
        System.out.println("ret2 = " + ret2);
        double a3 = 10.5;
        double b3 = 10.5;
        double c3 = 20.5;
        double ret3 = add(a3, b3, c3);
        System.out.println("ret3 = " + ret3);
    }

    public static int add(int x, int y) {
        return x + y;
    }

    public static double add(double x, double y) {
        return x + y;
    }

    public static double add(double x, double y, double z) {
        return x + y + z;
    }


    public static void main8(String[] args) {
        int n = 5;
        int ret = fac(n);
        System.out.println("ret = " + ret);
    }

    public static int fac(int n) {
        if (n == 1) {
            return 1;
        }
        return n * fac(n - 1);


// 执行结果
//    ret = 120

    }

    public static int fib(int n) {
        int last2 = 1;
        int last1 = 1;
        int cur = 0;
        for (int i = 3; i <= n; i++) {
            cur = last1 + last2;
            last2 = last1;
            last1 = cur;
        }
        return cur;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        fib(n);
    }
}




